home *** CD-ROM | disk | FTP | other *** search
/ Sky at Night 2007 June / SAN CD 6-2007 CD-ROM 25.iso / pc / Software / AstroGrav_Win / Java / jre1.6.0 / lib / rt.jar / java / security / Timestamp.class (.txt) < prev    next >
Encoding:
Java Class File  |  2006-11-29  |  1.5 KB  |  60 lines

  1. package java.security;
  2.  
  3. import java.io.Serializable;
  4. import java.security.cert.CertPath;
  5. import java.util.Date;
  6.  
  7. public final class Timestamp implements Serializable {
  8.    private static final long serialVersionUID = -5502683707821851294L;
  9.    private Date timestamp;
  10.    private CertPath signerCertPath;
  11.    private transient int myhash = -1;
  12.  
  13.    public Timestamp(Date var1, CertPath var2) {
  14.       if (var1 != null && var2 != null) {
  15.          this.timestamp = new Date(var1.getTime());
  16.          this.signerCertPath = var2;
  17.       } else {
  18.          throw new NullPointerException();
  19.       }
  20.    }
  21.  
  22.    public Date getTimestamp() {
  23.       return new Date(this.timestamp.getTime());
  24.    }
  25.  
  26.    public CertPath getSignerCertPath() {
  27.       return this.signerCertPath;
  28.    }
  29.  
  30.    public int hashCode() {
  31.       if (this.myhash == -1) {
  32.          this.myhash = this.timestamp.hashCode() + this.signerCertPath.hashCode();
  33.       }
  34.  
  35.       return this.myhash;
  36.    }
  37.  
  38.    public boolean equals(Object var1) {
  39.       if (var1 != null && var1 instanceof Timestamp) {
  40.          Timestamp var2 = (Timestamp)var1;
  41.          if (this == var2) {
  42.             return true;
  43.          } else {
  44.             return this.timestamp.equals(var2.getTimestamp()) && this.signerCertPath.equals(var2.getSignerCertPath());
  45.          }
  46.       } else {
  47.          return false;
  48.       }
  49.    }
  50.  
  51.    public String toString() {
  52.       StringBuffer var1 = new StringBuffer();
  53.       var1.append("(");
  54.       var1.append("timestamp: " + this.timestamp);
  55.       var1.append("TSA: " + this.signerCertPath.getCertificates().get(0));
  56.       var1.append(")");
  57.       return var1.toString();
  58.    }
  59. }
  60.